setClass("VListComputer",
		representation(
				.description="character",
				.reducer="Reducer",
				"VIRTUAL"
		),
		prototype=prototype(
				.description="Virtual List Computer class"
		
		)
)  
#generic functions
setGeneric("computeList",function(.Object,inputSet,...){standardGeneric("computeList")})
setGeneric("changeReducer",function(.Object,reducer,...){standardGeneric("changeReducer")})
setGeneric("containsNas",function(.Object,inputSet,...){standardGeneric("containsNas")})
#helper functions
#initialization method 
setMethod("initialize",
		signature="VListComputer",
		function(.Object,reducer,...){
			.Object@.reducer <-reducer
			return(.Object)
		})
#returns new modified object
#new obect must be manually assign
setMethod("changeReducer",
		signature="VListComputer",
		function(.Object,reducer,...){
			.Object@.reducer <-reducer
			return(.Object)
		})

setMethod("containsNas",
		signature="VListComputer",
		function(.Object,inputSet,...){
			if( {sum( is.na(inputSet$X) )>0} || {sum( is.infinite(inputSet$X) )>0}  ){
				stop("Reduced set Contains Na or NaN or Inf: ",
						get_description(.Object) )
			}
		})

setMethod("get_description",
		signature="VListComputer",
		definition=function(.Object){
			.Object@.description
		})

setMethod("computeList",
		signature="VListComputer",
		definition=function(.Object,inputSet,...){
			if(is.null(inputSet$X)){
				stop("input Set does not contain X element ")
			}
			if(! is.matrix(inputSet$X)){
				stop("input Set X element is not matrix ")
			}
			return(0)
		}
)

setMethod("cleanSavedSet",
		signature="VListComputer",
		definition=function(.Object,...){
			
			cleanSavedSet(.Object@.reducer)
			
			
		})
